package com.jtlrm.ckd.mvp.model;

import com.base.sdk.base.model.BaseModel;
import com.base.sdk.base.net.LifeCycleEvent;
import com.google.gson.JsonObject;
import com.jtlrm.ckd.entity.submitEntity.ShengHuaSubmitData;
import com.jtlrm.ckd.net.RetrofitUtil;

import io.reactivex.Observer;
import io.reactivex.subjects.PublishSubject;

public class ShengHuaModel  extends BaseModel {

    public void queryRiQi(String PatientId, Observer observer, PublishSubject<LifeCycleEvent> lifecycleSubject) {
        JsonObject jsonObject = new JsonObject();
        jsonObject.addProperty("PatientId", PatientId);
        RetrofitUtil.composeToSubscribe(RetrofitUtil.getService().queryShengHuaDate(jsonObject), observer, lifecycleSubject);
    }

    public void queryZhiBiao( Observer observer, PublishSubject<LifeCycleEvent> lifecycleSubject) {
        RetrofitUtil.composeToSubscribe(RetrofitUtil.getService().queryShengHuaZhiBiao(), observer, lifecycleSubject);
    }

    public void submitData(ShengHuaSubmitData submitData, Observer observer, PublishSubject<LifeCycleEvent> lifecycleSubject) {
        RetrofitUtil.composeToSubscribe(RetrofitUtil.getService().submitShengHuaData(createBody(submitData)), observer, lifecycleSubject);
    }

    public void queryShengHuaDataById(String treatmentId, Observer observer, PublishSubject<LifeCycleEvent> lifecycleSubject) {
        JsonObject jsonObject = new JsonObject();
        jsonObject.addProperty("treatmentId", treatmentId);
        RetrofitUtil.composeToSubscribe(RetrofitUtil.getService().queryShengHuaDateById(jsonObject), observer, lifecycleSubject);
    }

    public void checkShengHuaRiQi(String patientId,String measureDate, Observer observer, PublishSubject<LifeCycleEvent> lifecycleSubject) {
        JsonObject jsonObject = new JsonObject();
        jsonObject.addProperty("patientId", patientId);
        jsonObject.addProperty("measureDate", measureDate);
        RetrofitUtil.composeToSubscribe(RetrofitUtil.getService().checkShengHuaRiQi(jsonObject), observer, lifecycleSubject);
    }
}
